grammar MermaidFlow;

row: rowDef+;
rowDef: nodes|arrow;
nodes: (node|'&')+;
node: idDef nameDef| idDef;
nameDef: LEFT name RIGT;
idDef: id|id ':::' class;
class: NAME;
id: NAME;
name:TEXT|NAME;

arrow
  : Line '>'
  | Line   name  Line '>'
  | Line '>' '|' name '|'
  ;

/*
 * Lexer rules
 */
LEFT: [({[/]+;
RIGT: [)}\]\\]+;
NAME: ~[({}[\])\-=>&.|/\\: ]+;
TEXT: '"' ~["]+ '"';
Line: ('-'|'.'|'=')+;
WHITESPACE: [ \t] -> skip;